<?php
error_reporting(E_ALL);

// ID: $Id: Userclass.inc,v 1.21 2005/04/03 02:57:33 Exp $

class Profile
{
    private $_horv;
    private $_res;
    private $_fontsize;
    private $_fontface;
    private $_zoom;
    private $_text_width;
    private $_tlines;
    private $_tscroll;
    private $_twrap;
    private $_enhanced;
    private $_resolutions = array(
	    '640x480',
	    '800x600',
	    '1024x768',
	    '1152x864',
	    '1280x1024',
	    '1600x1200',
	    '1280x720',
	    '1280x854',
	    '1280x960',
	    '1400x1050',
	    '1600x1024',
	    '1920x1080',
	    '600x800',
	    '768x1024',
	    '1024x1280',
	    '1200x1600',
	    '720x1280',
	    '960x1280',
	    '1050x1400',
	    '1024x1600',
	    '1080x1920');

    public function Profile($fontsize,
                            $fontface,
                            $zoom,
                            $text_width,
                            $tlines,
                            $tscroll,
                            $twrap,
                            $horv,
                            $res,
                            $enhanced)
    {
        $this->_fontsize    = $fontsize;
        $this->_fontface    = $fontface;
        $this->_zoom        = $zoom;
        $this->_text_width  = $text_width;
        $this->_tlines      = $tlines;
        $this->_tscroll     = $tscroll;
        $this->_twrap       = $twrap;
        $this->_horv        = $horv;
        $this->_res         = $res;
        $this->_enhanced    = $enhanced;
    }

    public function TextWidth()
    {
        return $this->HorV() == 'V' ? $this->_text_width
                                  : 99;
    }

    public function TextHeight()
    {
        return $this->HorV() == 'V' ? 99
                                  : $this->_text_width;
    }

    public function ImageWidth()
    {
        return $this->HorV() == 'V' ? 100 - $this->TextWidth() - 1
                                  : $this->_text_width;
    }

    public function ImageHeight()
    {
        return $this->HorV() == 'V' ? 99
                                  : 100 - $this->TextHeight() - 1 ;
    }

    public function TextLeft()
    {
        return $this->HorV() == 'V' ? (100 - $this->TextWidth()) ."%"
                                  : "1%";
    }

    public function ScreenPixelHeight()
    {
    	$pair = $this->ResolutionPair();
    	return $pair[1];	
    }
    
    public function ScreenPixelWidth()
    {
    	$pair = $this->ResolutionPair();
    	return $pair[0];	    	
    }
    
    public function TextTop()
    {
        return $this->HorV() == 'V' ? "1%"
                                  : (100 - $this->TextHeight()) ."%";
    }

    public function Enhanced()
    {
        return $this->_enhanced;
    }

    private function ResolutionIndex()
    {
        return $this->_res;
    }

    private function ResolutionString()
    {
    	return $this->_resolutions[$this->ResolutionIndex()];
    }
    
    public function ResolutionPair()
    {
    	return explode('x', $this->ResolutionString());
    }
    
    public function FontSize()
    {
        return $this->_fontsize;
    }

    public function FontFace()
    {
        return $this->_fontface;
    }

    public function Zoom()
    {
        return $this->_zoom;
    }

    public function TextLines()
    {
        return $this->_tlines;
    }

    public function IsTextScroll()
    {
        return ! empty($this->_tscroll);
    }

    public function IsTextWrap()
    {
        return !empty( $this->_twrap);
    }

    public function HorV()
    {
        return $this->_horv;
    }
}
